PATHMac OS 8 and 9 Developer Documentation > Interapplication Communication > AppleScript for Scripters >

AppleScript Language Guide

   

Control Statements

Control statements are described in detail in Control Statements.

Control statements are statements that control when and how other statements are executed. Table A-9 summarizes the control statements in the AppleScript English dialect. For more information about control statements, see Control Statements

Table A-9   Control statements  

Control
statement

Syntax

tell tell referenceToObject to statement
tell referenceToObject
[ statement ]...
end [ tell ]
if if Boolean then statement
if Boolean [ then ]
[ statement ]...
[ else if Boolean [ then ]
[ statement ]...]...
[ else
[ statement ]...]
end [ if ]
repeat repeat
[ statement ]...
end [ repeat ]
repeat integer [ times ]
[ statement ]...
end [ repeat ]
repeat while Boolean
[ statement ]...
end [ repeat ]
repeat until Boolean
[ statement ]...
end [ repeat ]
repeat with variable from integer to integer [ by integer ]
[ statement ]...
end [ repeat ]
repeat with variable in list
[ statement ]...
end [ repeat ]
exit exit
try try
[ statement ]...
on error ¬
[ errorMessageVariable ] ¬
[ number errorNumberVariable ] ¬
[ from offendingObjectVariable ] ¬
[ partial result resultListVariable ] ¬
[ to expectedTypeVariable ]
[ global variable [, variable ]...]
[ local variable [, variable ]...]
[ statement ]...
end [ error | try ]
considering considering attribute [, attribute ... and attribute ]   [ but ignoring attribute [, attribute ... and attribute ] ]
[ statement ]...
end considering
ignoring ignoring attribute [, attribute ... and attribute ] [ but considering attribute [, attribute ... and attribute ] ]
[ statement ]...
end ignoring
with timeout with timeout [ of ] integer second[s]
[ statement ]...
end [ timeout ]
with transaction with transaction [ session ]
[ statement ]...
end [ transaction ]

© 1999 Apple Computer, Inc. – (Last Updated 21 May 99)